# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
from ragendja.urlsauto import urlpatterns
from ragendja.auth.urls import urlpatterns as auth_patterns
from django.contrib.auth import views as auth_views
from django.contrib import admin
from django.views.generic.simple import direct_to_template
from bvuserapp.forms import UserRegistrationForm
from bvuserapp import views as user_views
from bvrssapp.feeds import VCFinancing, VCFinancingTwitter
from registration.views import activate

feeds = {
    'vcfinancing': VCFinancing,
    'vcfinancingtwitter' : VCFinancingTwitter,
}

admin.autodiscover()

handler500 = 'ragendja.views.server_error'

urlpatterns = auth_patterns + patterns('',
    ('^admin/(.*)', admin.site.root),
    (r'^$', 'django.views.generic.simple.direct_to_template',
        {'template': 'main.html'}),
    (r'^about/', 'django.views.generic.simple.direct_to_template',
        {'template': 'about.html'}),
    (r'^blog/', 'django.views.generic.simple.direct_to_template',
        {'template': 'blog.html'}),
    (r'^contact', 'django.views.generic.simple.direct_to_template',
        {'template': 'contact.html'}),
    # (r'^faq', 'django.views.generic.simple.direct_to_template',
    #     {'template': 'faq.html'}),
    (r'^join', 'django.views.generic.simple.direct_to_template',
        {'template': 'join.html'}),
    (r'^', include('bvapp.urls')),
    (r'^map/', include('bvmapapp.urls')),
    (r'^users/\w+/', include('bvblogapp.urls')),
    (r'^mt/', include('bvmtapp.urls')),
    (r'^reports/', include('reports.urls')),
    (r'^convert_images/$', include('reports.images_urls')),
    (r'^', include('bvuserapp.urls')),
    (r'^(sitemap.xml)', 'django.views.static.serve', {'document_root': 'F:/google_app/sitemap/'}),                           
                                       
    (r'^faq/', include('faq.urls')),
    
    (r'^search/', include('bvsearchapp.urls')),
    
    # (r'^xhtml2pdf/', include('pdfcreator.urls')),
    (r'^myapp/', include('myapp.urls')),

    (r'^feeds/(?P<url>.*)/$',
        'django.contrib.syndication.views.feed',
        {'feed_dict': feeds}),
    #these are overides for the default user management forms/templates in the registration application
    url(r'^account/register/$', 
        'registration.views.register',
        kwargs={'form_class': UserRegistrationForm, 'template_name':'registration/registration_form.html'},
        name='registration_register'),
    url(r'^account/register/complete/$',
        direct_to_template,
        {'template': 'registration/registration_complete.html'},
        name='registration_complete'),
    url(r'^account/activate/(?P<activation_key>\w+)/$',
        activate,
        {'template_name': 'registration/activate.html'},
        name='registration_activate'),
    url(r'^account/login/$',
        auth_views.login,
        {'template_name': 'registration/login.html'},
        name='auth_login'),
    url(r'^account/logout/$',
        auth_views.logout,
        {'template_name': 'registration/logged_out.html'},
        name='auth_logout'),
) + urlpatterns

